using System;
using System.Collections.Generic;
using System.Text;

namespace Eve.Data
{
    public class CharacterAttribute : EveProperty
    {
        private string attributeName;
        private string description;
        private int graphicId;
        private string shortDescription;
        private string notes;

        private Graphic graphic;

        public string Name
        {
            get { return attributeName; }
        }
        public string Description
        {
            get { return description; }
        }
        public Graphic Graphic
        {
            get
            {
                if (graphic == null)
                    graphic = new Graphic(db, graphicId);
                return graphic;
            }
        }
        public string ShortDescription
        {
            get { return shortDescription; }
        }
        public string Notes
        {
            get { return notes; }
        }

        internal CharacterAttribute(DbDataRow dr)
            : base(dr.Database, EvePropertyType.CharacterAttribute, dr["attributeID"])
        {
            Fill(dr);
        }
        internal CharacterAttribute(Database db, int id)
            : base(db, EvePropertyType.CharacterAttribute, id)
        {
            Fill(db.ExecuteSingle("SELECT * FROM chrAttributes WHERE attributeID=" + id));
        }

        private void Fill(DbDataRow dr)
        {
            attributeName = dr["attributeName"];
            description = dr["description"];
            graphicId = dr["graphicID"];
            shortDescription = dr["shortDescription"];
            notes = dr["notes"];
        }
    }
}
